﻿using Infragistics.Composite.Wpf.Samples.Infrastructure;
using Microsoft.Practices.Composite.Modularity;
using Microsoft.Practices.Composite.Regions;

namespace Infragistics.Composite.Wpf.Samples.SearchModule
{
    public class SearchModule : IModule
    {
        readonly IRegionManager _regionManager;

        public SearchModule(IRegionManager regionManager)
        {
            _regionManager = regionManager;
        }

        #region IModule Members

        public void Initialize()
        {
            IRegion region = _regionManager.Regions[RegionNames.DockingAreaRegion];
            if (region == null)
                return;

            SearchView view = new SearchView();
            view.DataContext = new SearchViewModel();
            region.Add(view);
            region.Activate(view);
        }

        #endregion // IModule Members
    }
}